import http from 'http';
import { Response, HttpResponse } from './response';
import { Request, HttpRequest } from './request';

export default class Context {
  response: Response;
  request: Request;

  constructor({ req, res }: { req: http.IncomingMessage; res: http.ServerResponse }) {
    this.response = new HttpResponse(res);
    this.request = new HttpRequest(req);
  }

  // FIXME: 有啥用？
  onerror(error: Error): void {
    console.log(error);
  }
}
